package com.huluobo.lc.kotlinim1803a.contract.splash

import com.huluobo.lc.kotlinim1803a.contract.splash.SplashContract
import com.hyphenate.chat.EMClient

/**
 * @author Lc
 * @description: 功能:检查登录状态
 * @date :2020/9/10 19:29
 */
class SplashPresenter(private val view: SplashContract.View) : SplashContract.Presenter {
    override fun checkLoginStatus() {
        if (isLoggedIn()) view.onLoggedIn() else view.onNotLoggedIn()
    }

    //是否登录到环信
    //开机MVP中的M层,获取开机模型
    private fun isLoggedIn(): Boolean =
        EMClient.getInstance().isConnected && EMClient.getInstance().isLoggedInBefore
}